import java.nio.file.Path;
import java.io.File;
import java.lang.String;

import Algo.Algo;
/*	this algorithm return tags according to the full path*/
public class PathAlgo implements Algo{
	public String [] tagFile(Path child){
		String pathString=child.toString();
		File myFile = new File(pathString);
		if 	(myFile.isDirectory()){
			return null;
		}
		String keyWords[]=pathString.split("\\\\");
		String tags[]=new String[keyWords.length-1];
		int i;
		for ( i=1;i<keyWords.length-1;i++){
			tags[i-1]=keyWords[i];
		}
		String temp[]=keyWords[i].split("[.]");
		tags[i-1]=temp[temp.length-1];
		return tags;
	}
	public String descript(){
		return "this algorithm return tags according to the full path";
	}
	public String toString(){
		return "PathAlgo";
	}
}
